<h4 class="header">
  <%= _("Host Subscription Status") %>
</h4>

<% if Organization.current.blank? %>
  <p class="ca"><%= _("Please select an organization to view subscription status.") %></p>
<% else %>
  <% total_count = total_host_count() %>
  <% partial_consumer_count = partial_consumer_count() %>
  <% valid_consumer_count = valid_consumer_count()%>
  <% invalid_consumer_count = invalid_consumer_count()%>
  <% unknown_consumer_count = unknown_consumer_count() %>
  <% subscription_status_url = '/content_hosts?search='%>
  <% registered_subscription_url = subscription_status_url + ERB::Util.url_encode('subscription_status = ') %>
  <% unknown_search_url = registered_subscription_url + 'unknown or (null? subscription_uuid)' %>

  <table class="table table-fixed table-striped table-bordered">
    <thead>
      <tr>
        <th></th>
        <th class='ellipsis'><%= _("Count") %></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>
          <%= link_to("#{registered_subscription_url}" + 'invalid') do %>
            <i class="label label-danger" style="margin-right: 6px">&nbsp;</i><%= _("Invalid") %>
          <% end %>
        </td>
        <td style="text-align:right">
          <%= link_to( "#{invalid_consumer_count}", "#{registered_subscription_url}" + 'invalid')%>
        </td>
      </tr>
      <tr>
        <td>
          <%= link_to("#{registered_subscription_url}" + 'partial') do %>
            <i class="label label-warning" style="margin-right: 6px">&nbsp;</i><%= _("Partial") %>
          <% end %>
        </td>
        <td style="text-align:right">
          <%= link_to( "#{partial_consumer_count}", "#{registered_subscription_url}" + 'partial')%>
        </td>
      </tr>
      <tr>
        <td>
          <%= link_to("#{registered_subscription_url}" + 'valid') do %>
            <i class="label label-success" style="margin-right: 6px">&nbsp;</i><%= _("Valid") %>
          <% end %>
        </td>
        <td style="text-align:right">
          <%= link_to( "#{valid_consumer_count}", "#{registered_subscription_url}" + 'valid')%>
        </td>
      </tr>
      <tr>
        <td>
          <%= link_to("#{registered_subscription_url}" + 'unsubscribed_hypervisor') do %>
              <i class="label label-warning" style="margin-right: 6px">&nbsp;</i><%= _("Unsubscribed Hypervisor") %>
          <% end %>
        </td>
        <td style="text-align:right">
          <%= link_to( "#{unsubscribed_hypervisor_count}", "#{registered_subscription_url}" + 'unsubscribed_hypervisor')%>
        </td>
      </tr>
      <tr>
        <td>
          <%= link_to(unknown_search_url) do %>
              <i class="label label-warning" style="margin-right: 6px">&nbsp;</i><%= _("Unknown or Unregistered") %>
          <% end %>
        </td>
        <td style="text-align:right">
          <%= link_to("#{unknown_consumer_count}", unknown_search_url)%>
        </td>
      </tr>
      <tr>
        <td><h4>
            <%= link_to("Total Content Hosts", '/content_hosts')%>
        </h4></td>
        <td style="text-align:right;">
          <%= link_to( "#{total_count}", '/content_hosts')%>
        </td>
      </tr>
    </tbody>
  </table>
<% end %>
